package com.example.gyrodemo;

import androidx.appcompat.app.AppCompatActivity;

import android.app.Activity;
import android.hardware.Sensor;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.widget.TextView;

import java.util.List;

public class ShowSupportedSensorsActivity extends Activity {
    private SensorManager mSensorManager;
    private TextView mTextView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_show_supported_sensors);
        mTextView = (TextView)findViewById(R.id.tvsensors);

        mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);

        List<Sensor> sensors = mSensorManager.getSensorList(Sensor.TYPE_ALL);
        String s = "";
        for (int i = 1; i < sensors.size(); i++) {
            s += ("[" + i + "] " + sensors.get(i).toString() + "\n");
        }

        mTextView.setText(s);
    }
}